using ClassDemo.Model;
using ClassDemo.Model.Entity;

namespace ClassDemo.Services;

/// <summary>
/// JWT服务接口
/// </summary>
public interface IJwtService
{
    /// <summary>
    /// 生成JWT令牌
    /// </summary>
    /// <param name="teacher">教师信息</param>
    /// <returns>JWT令牌</returns>
    string GenerateToken(Teacher teacher);

    /// <summary>
    /// 生成JWT令牌
    /// </summary>
    /// <param name="student">学生信息</param>
    /// <returns>JWT令牌</returns>
    string GenerateToken(Student student);

    /// <summary>
    /// 验证JWT令牌
    /// </summary>
    /// <param name="token">JWT令牌</param>
    /// <returns>是否有效</returns>
    bool ValidateToken(string token);

    /// <summary>
    /// 从令牌中获取用户ID
    /// </summary>
    /// <param name="token">JWT令牌</param>
    /// <returns>用户ID</returns>
    int? GetUserIdFromToken(string token);
}